@use "sass:map";
@import "../node_modules/bootstrap/scss/bootstrap";
@import "./pytch-mixins.scss";
@import "./pytch-variables.scss";

body.pytch-toplevel {
  // Use (older version of) Bootstrap's "reboot" font choice for now.
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;

  a,
  a:hover {
    text-decoration: none;
  }
}

code {
  font-family: $monospace-fonts;
}

.App {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background-color: #ddf;
  overflow-y: auto;
}

.NavBar {
  background-color: #228;
  color: white;
  padding: 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  .title-and-version {
    h1 {
      display: inline-block;
      margin-right: 0px;
      span.beta-tag {
        margin-left: 0.625rem;
        font-size: 1rem;
      }
    }
    p.version-tag {
      display: inline-block;
      font-size: 0.875rem;
      margin-bottom: 0px;
      margin-left: 6px;
      a {
        color: #aaa;
      }
    }
  }
  h1 {
    padding: 8px;
    margin: 0px 2rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
  }
  h1:hover,
  li:hover {
    background-color: #44b;
    border-radius: 4px;
  }
  ul {
    margin: 0px;
    li {
      display: inline-block;
      margin-right: 2rem;
      padding: 8px;
      font-size: 1.25rem;
      color: white;
      cursor: pointer;
      user-select: none;
      a {
        color: white;
      }
    }
  }
}

.welcome-text {
  font-size: 110%;
  margin: 2rem 6rem;

  h1 {
    margin: 1.5rem 0rem;
  }

  .bridge-text-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
  }

  .bridge-text {
    max-width: 48rem;
    margin: 2rem 3rem 1rem;
    display: flex;
    flex-direction: row;
    align-items: center;

    p {
      text-align: justify;
      margin: 0.5rem 3rem;

      &.contact-email {
        font-size: 1.125rem;
        text-align: center;
      }
    }
  }

  .demo-cards {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
  }

  h2 {
    margin: 3.5rem 0rem 1.5rem;
  }

  .way-of-using-pytch {
    margin: 2rem 3rem;
    display: flex;
    flex-direction: row;
    align-items: center;

    .button-wrapper {
      flex-shrink: 0;
      flex-grow: 0;
      width: 12rem;
      text-align: center;
    }

    p {
      margin: 0rem;
      flex-grow: 1;
    }
  }

  .logo-strip {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-evenly;
    img {
      padding: 2rem 1rem;
    }
  }
}

.unknown-route {
  max-width: 36rem;
  font-size: 1.25rem;
  background-color: #faa;
  color: black;
  padding: 2rem;
  border-radius: 8px;
  margin: auto;
}

.loading-in-progress {
  z-index: 1;
  position: absolute;
  left: 0px;
  right: 0px;
  top: 0px;
  bottom: 0px;

  .background {
    position: absolute;
    left: 0px;
    right: 0px;
    top: 0px;
    bottom: 0px;
    border-radius: 4px;
    background-color: black;
    opacity: 0.6;
  }

  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;

  .content {
    z-index: 2;
    color: white;
    opacity: 1;
    font-size: 2rem;
    text-align: center;
  }
}

$tutorial-mini-card-screenshot-width: 240px;
$tutorial-mini-card-border-gap: 2px;
$tutorial-mini-card-border-width: 3px;

.TutorialMiniCard {
  margin: 1rem 0.5rem;
  position: relative;

  p {
    max-width: calc(
      #{$tutorial-mini-card-screenshot-width} + 2 * (#{$tutorial-mini-card-border-width} +
            #{$tutorial-mini-card-border-gap})
    );
  }

  h2 {
    margin: 0.25rem 0rem 0.75rem;
    text-align: center;
    font-size: 1.5rem;
    color: #111;
  }

  .screenshot {
    padding: 2px;
    border-radius: 2px;
    border: 3px solid transparent;
    &.enabled {
      &:hover {
        border: 3px solid rgb(0, 123, 255);
      }
      cursor: pointer;
    }
  }
}

$tutorial-display-side-margin: 3rem;

.TutorialList {
  overflow-y: auto;
  flex-shrink: 1;
  flex-grow: 1;
  h1 {
    margin: 1.5rem 0px;
    text-align: center;
  }
  ul {
    margin: 0px #{$tutorial-display-side-margin};
    padding: 0px;
    list-style: none;
    li {
      margin: auto;
      max-width: 52rem;
      p {
        margin: 0px;
        padding: 1.25rem 0px;
        font-size: 1.125rem;

        .project-description {
          margin-right: 1rem;

          .project-name {
            font-weight: bold;
          }

          /* Temporary while developing: */
          .project-id {
            margin-right: 2rem;
            color: #888;
          }

          .project-summary {
            margin-left: 1rem;
            font-style: italic;
          }
        }
      }

      .ProjectCard .selection-check {
        margin-right: 1rem;
        visibility: hidden;

        &.selected {
          color: theme-color("primary");
          visibility: visible;
        }
      }
      .ProjectCard:hover .selection-check {
        visibility: visible;
        color: #aaa;

        &.selected,
        &.selected:hover {
          color: theme-color("primary");
        }
        &:hover {
          color: mix(map.get($theme-colors, "primary"), #aaa, 50%);
        }
      }

      .ProjectCard:hover {
        border: 1px solid black;
      }
      div:after {
        content: "";
        clear: both;
        display: table;
      }
    }
  }
  .buttons {
    width: 28rem;
    padding: 0.75rem 0px;
    margin: 1.5rem auto;
    border-radius: 8px;

    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    &.some-selected {
      background-color: #eee;

      .intro {
        display: flex;
        flex-direction: row;
        align-items: center;
        button {
          margin-right: 0.5rem;
        }
        span {
          font-size: 1.25rem;
          font-weight: bold;
          width: 2rem;
          margin: 0px 4rem 0px 0px;
        }
      }
    }

    text-align: center;

    button {
      margin: 0px 2rem;
    }
  }
  .image-container {
    float: right;
    margin: 2.5rem 2rem 0rem 2rem;
  }
  .dropdown-wrapper {
    float: right;
    margin: 1rem;
  }
  .loading-in-progress {
    p {
      font-size: 2rem;
    }
  }
  .loading-placeholder,
  .loading-error {
    margin: 0rem #{$tutorial-display-side-margin};
    border-radius: 4px;

    p {
      padding: 4rem;
      text-align: center;
    }
  }
  .loading-placeholder {
    background-color: #aaa;
    p {
      font-size: 1.5rem;
      color: white;
    }
  }
  .loading-error {
    background-color: #faa;
    p {
      font-size: 1.25rem;
      color: black;
    }
  }
  .button-wrapper {
    margin-top: 2.5rem;
    text-align: center;
  }
}

.TutorialCard {
  position: relative;
  .info-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;

    display: flex;
    flex-direction: row;
    align-items: start;

    .EditorKindThumbnail {
      &,
      img {
        border-radius: 3px;
      }
      box-shadow: none;
      margin-right: 0px;
      margin-left: 0.75rem;
    }

    p {
      padding: 0.25rem 0.5rem;
      background-color: mintcream;
      border-radius: 5px;
    }
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  .button-bar {
    display: inline-block;
    button {
      margin: 0.5rem 1.5rem 1.5rem;

      &:first-child {
        margin-left: 0rem;
      }
    }
  }
}

.tutorial-list li {
  position: relative;
}

.tutorial-list.demo-only {
  width: 32rem;
  margin: auto;
  .button-bar {
    width: 100%;
    text-align: center;
    button {
      margin: 0.5rem 1.5rem 1.5rem;
    }
  }
}

.dropdown-item.danger {
  background-color: #faa;

  &:hover {
    background-color: #d88;
  }
}

button.awaiting-action {
  position: relative;
  .spacing-text {
    visibility: hidden;
  }
  .spinner-container {
    position: absolute;
    left: 0px;
    right: 0px;
    top: 0px;
    bottom: 0px;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
  }
}

.modal.CreateProjectModal {
  .whether-include-example,
  .editor-kind {
    .option-buttons {
      margin-top: 0rem;
      display: flex;
      flex-direction: row;
      justify-content: space-evenly;
    }
    .editor-thumbnail {
      margin-top: 1rem;
      text-align: center;
      img {
        box-shadow: 0px 0px 6px 4px #bbb;
      }
    }
  }
}

.GoogleAuthenticationStatusModal,
.GoogleTaskStatusModal {
  .modal-body.pending {
    text-align: center;
  }
  .spinner-border {
    margin: 1.5rem;
  }
}

.GoogleTaskStatusModal {
  .user-info {
    p {
      margin: 0px;
    }
    code {
      color: #741f46;
    }
    font-size: 1rem;
  }

  .outcome-summary {
    padding: 0.5rem;
    border-radius: 6px;
    &.successes {
      background-color: var(--bs-success-bg-subtle);
      margin-bottom: 1.5rem;
    }
    &.failures {
      background-color: var(--bs-danger-bg-subtle);
    }
  }
}

.ExceptionDisplay {
  @include full-center-middle();

  .content {
    background-color: #faa;

    max-width: 36rem;
    font-size: 1.25rem;
    color: black;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 3rem;

    .button-container {
      margin-top: 2rem;
      text-align: center;
    }
  }
}

.EditorKindThumbnail {
  margin-right: 1.25rem;
  box-shadow: 0px 0px 6px 4px #bbb;
}
